package moodish.dummy;

import java.io.Serializable;

import moodish.comm.ClientSideMessage;

/**
 * Messages sent from the server to clients. A message contains a type (enum), 
 * a sender (String) and a payload (String).
 * <p>
 * When a Moodish message is being sent from one user to his/her friends, the sender
 * is the nickname of the client. For all other messages the sender's nickname should be {@link #SERVER}. 
 * <p>
 * 
 * 
 * @author group27
 * @version 1 
 */

public class ClienteSideMessage implements ClientSideMessage,Serializable {
	
	private String payload;
	private Type type;
	private String from;
	
	public ClienteSideMessage(String from, String payload, Type type){
		this.from=from;
		this.payload=payload;
		this.type=type;
	}
	
	/**
	 * Gets the payload of the message.
	 * 
	 * @return payload.
	 */
	
	@Override
	public String getPayload() {
		return payload;
	}
	
	/**
	 * Gets the type of the message.
	 * 
	 * @return type of the message.
	 */

	@Override
	public Type getType() {
		return type;
	}

	/**
	 * Gets the sender of the message. The sender is the nickname of the message sender in case the message sent is 
	 * a Moodsih message from one client to another. For all other messages. The sender will be {@link #SERVER}
	 * 
	 * @return nickname of the sender.
	 */
	
	@Override
	public String getSendersNickname() {
		return from;
	}

}
